# pip install pandas
# pip install matplotlib
from matplotlib import font_manager
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_excel("商品销售记录.xlsx")
# print(type(df), df)
font_name_list = font_manager.get_font_names()
print(font_name_list)
labels = df["商品名称"]
january_sales_num = df["1月"]
# print(labels)
# print(january_sales_num)
# 存在乱码问题
plt.rcParams["font.sans-serif"] = 'Noto Sans CJK JP'
plt.figure(figsize=(200, 10))
plt.pie(january_sales_num, labels=labels, autopct="%1.2f%%", startangle=90)
# plt.pie(january_sales_num, labels=labels)
plt.axis("on")
plt.title("一月份商品销量百分比")
plt.show()
